import * as fetch from 'common/fetch.js';

/**
 * 获取所有分类列表
 */
export function classifyList({pid}) {
  return fetch.get('/goods/goodsTypeList/'+pid);
}

/**
 * 获取商品推荐列表 
 */
export function goodsRecommendList({pageNo, pageSize}) {
  return fetch.get('/goods/goodsListFromSolr?pageNo='+pageNo+"&pageSize="+pageSize);
}

/**
 * 获取商品列表 
 */
export function goodsList({goodsName, minPrice, maxPrice, sortDirection, sortKeyword, pageNo, pageSize}) {
  return fetch.get('/goods/goodsListFromSolr?goodsName='+goodsName+'&minPrice='+minPrice*100+'&maxPrice='+maxPrice*100+'&sortDirection='+sortDirection+"&sortKeyword="+sortKeyword+"&pageNo="+pageNo+"&pageSize="+pageSize);
}

/**
 * 获取商品详情
 */
export function goodsDetail({goodsId}) {
  return fetch.get('/goods/goodsInfo/'+goodsId);
}